import {
	mapGetters
} from 'vuex'
export default {
	computed: {
		...mapGetters('car', ['totalCount'])
	},
	onShow() {
		this.computedTotalCount()

	},
	watch: {
		totalCount() {
			this.computedTotalCount()
		}
	},
	methods: {
		computedTotalCount() {
			if (this.totalCount === 0) {
				uni.removeTabBarBadge({
					index: 2
				})
			} else {
				uni.setTabBarBadge({
					index: 2,
					text: this.totalCount.toString()
				})
			}
		}
	}
}